Skip to content

3. add verified updates and rollback for compiled installs - #2166

Merged
kevinjosethomas merged 5 commits into
mainfrom
feat/eng-6047-native-updates
Sep 12, 2026
Merged

kevinjosethomas merged 5 commits into
mainfrom
feat/eng-6047-native-updates

Conversation

@kevinjosethomas

@kevinjosethomas kevinjosethomas commented Sep 9, 2026

Copy link
Copy Markdown
Member

This is part of the PR stack migrating us to use Bun to compile Prime Agent for releases. This makes supported installations self-contained, removing the need to download and install Node.js and npm packages separately.

This PR adds updates and rollback for compiled installations. Users update through the usual command, downloads are checked before activation, and restarted sessions use the new version. Prime Agent keeps the previous compiled release so users can switch back without downloading it again.

Tested updates between simulated Bun-compiled releases, offline rollback, corrupt downloads, simultaneous updates, and interrupted updates. The combined stack passed 109 of 110 scenarios; the remaining case was the existing npm 12 restriction, with tested recovery. Forced termination can require manual recovery. The final release-metadata fix passed 44 targeted tests.

ENG-6047 · Stack: #2140#2165#2166.

Note

Add verified updates and offline rollback for compiled native installs

  • Adds an offline rollback command to install.sh that restores a validated previous compiled release without downloading. The update command now accepts --rollback for Bun-compiled self-updates through getSelfUpdatePlan in package-manager-cli.ts.
  • Native release validation now checks release-target naming, asset file types and symlink status, archive checksums, package versions, and bounded executable probes with a 10-second timeout. Invalid releases are rejected before activation.
  • Activation writes a two-line .activation-state file with intended current and previous targets, enabling recovery after interrupted link replacements. Root preparation and cleanup now recover interrupted activations, sweep orphan staging directories, and prune eligible inactive releases.
  • config.getUpdateInstruction returns the application update command for Bun binaries with a detected native installation. Release manifests can carry validated native binary artifacts via getLatestPiRelease in version-check.ts.
  • Risk: readNativeRollbackInstallation throws on ambiguous activation state instead of guessing; parsePackageCommand rejects --rollback combined with extension targets or non-self sources; prime_agent_native_valid_target now rejects release paths that do not match the strict version/platform/digest naming format, which may break manually-created release directories that previously passed the looser path-shape check.

Macroscope summarized dd43e70.


Note

High Risk
Changes core install/update/rollback and launcher activation paths; stricter release naming and validation can reject previously tolerated layouts, and failed recovery depends on manual lock/state cleanup.

Overview
Adds self-update and offline rollback for managed compiled installs: prime-agent update (and /update) can fetch a checksum-verified archive or run install.sh --rollback to swap launchers without re-downloading.

The shell installer gains durable .activation-state journaling before symlink changes, automatic recovery on the next run, stricter release-dir validation (assets, checksum marker, version/help probes with a 10s timeout), optional PRIME_AGENT_EXPECTED_* guards for planned updates, and conservative pruning of orphan staging dirs and inactive releases when lsof shows the binary unused.

The CLI wires --rollback through package self-update, plans native updates via getNativeUpdatePlan (release manifest binaries + SHA-256), and relaunches post-update through the managed launcher instead of the running binary. Release metadata parsing keeps npm update paths working when native entries are invalid.

Docs, changelog, CI (including probe-timeout tests), and broad installer/regression tests cover interrupted activation, damaged releases, and daemon restart behavior.

Reviewed by Cursor Bugbot for commit dd43e70. Bugbot is set up for automated code reviews on this repo. Configure here.

@kevinjosethomas
kevinjosethomas changed the base branch from main to feat/eng-6046-native-migration September 9, 2026 22:32
Comment thread install.sh
@kevinjosethomas
kevinjosethomas changed the base branch from feat/eng-6046-native-migration to main September 9, 2026 22:41
@kevinjosethomas
kevinjosethomas changed the base branch from main to feat/eng-6046-native-migration September 9, 2026 22:43
@kevinjosethomas
kevinjosethomas changed the base branch from feat/eng-6046-native-migration to main September 9, 2026 23:07
kevinjosethomas added a commit that referenced this pull request Sep 9, 2026
@kevinjosethomas
kevinjosethomas changed the base branch from main to feat/eng-6046-native-migration September 9, 2026 23:11
@kevinjosethomas
kevinjosethomas changed the base branch from feat/eng-6046-native-migration to main September 9, 2026 23:30
@kevinjosethomas
kevinjosethomas changed the base branch from main to feat/eng-6046-native-migration September 9, 2026 23:30
@kevinjosethomas
kevinjosethomas changed the base branch from feat/eng-6046-native-migration to main September 9, 2026 23:32
kevinjosethomas added a commit that referenced this pull request Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Prime Agent performance — completed

PR dd43e701 compared with main 19f959ba.

Overall: 0 regressed · 0 improved · 17 no clear change.

Metric Main This PR Change
Cold startup 1,387.8 ms 1,335.8 ms ≈ -52.0 ms (-3.74%)
Warm startup 811.4 ms 816.7 ms ≈ +5.3 ms (+0.65%)
Installation 12.39 s 12.14 s ≈ -0.25 s (-2.00%)
Compressed release artifacts 70.00 MB 69.97 MB ≈ -0.03 MB (-0.04%)
Installed footprint 571.90 MB 571.97 MB ≈ +0.07 MB (+0.01%)
Idle memory, summed RSS 1,090.81 MB 1,092.58 MB ≈ +1.78 MB (+0.16%)

Python runtime

Metric Main This PR Change
Python kernel startup 124.8 ms 126.3 ms ≈ +1.5 ms (+1.22%)
Python cell round trip 0.511 ms 0.491 ms ≈ -0.020 ms (-3.97%)
Empty bash command 10.6 ms 10.9 ms ≈ +0.3 ms (+3.03%)
Bash git status 16.5 ms 16.4 ms ≈ -0.1 ms (-0.70%)
Bash 32 KiB output 11.2 ms 11.4 ms ≈ +0.2 ms (+1.63%)
35 cells / 9 shell calls 155.7 ms 157.6 ms ≈ +1.9 ms (+1.24%)
Python interrupt to done 1.469 ms 1.521 ms ≈ +0.051 ms (+3.49%)
Python state snapshot 25.5 ms 24.9 ms ≈ -0.6 ms (-2.38%)
Python state restore 352.1 ms 359.2 ms ≈ +7.1 ms (+2.02%)
Python idle RSS 35.68 MB 36.00 MB ≈ +0.32 MB (+0.90%)
Python RSS after pandas workload 98.83 MB 98.48 MB ≈ -0.35 MB (-0.36%)

Sandbox cost: ~$0.0691 — no inference calls.
Run, logs, and downloadable raw results

Methodology and samples

Main resolved at 2026-09-12T08:53:52.658864+00:00. Harness 19f959ba.
Linux x64, 4 vCPU, 8 GB RAM, 20 GB disk; region us.
Image: node:24-bookworm@sha256:be23f54a88d34e8824c741b19b91064094f92c1c97b194144bfc8b50d67258e2.
Stock tools, skills, daemon, and Python bootstrap enabled; fresh homes and a fixed Git fixture.
Onboarding is dismissed; the editor starts without a selected model or submitted prompt.
Medians shown. Arrows require a 20% timing/memory change plus absolute floors and IQR.
These practical noise floors are not a statistical significance test.
Cold means stopped Prime processes; OS filesystem caches are not flushed.
No model requests or credentials. Installation excludes build/setup time.
Installer tarballs use loopback; npm/Python downloads use the network with fresh caches.
Artifact size counts release tarballs; footprint after first use includes registry packages.
MB is decimal. Summed RSS can double-count shared pages; PSS is recorded when available.
Provisioning, setup, and build durations are recorded separately in the raw results.
Kernel probes use the installed JSONL runtime, outside the TUI/TypeScript host.
Per trial: 50 Python cells, 5 calls per shell case, and one 35-cell mix (9 git status calls).
Cell/shell values are batch means; other runtime timings are single operations.
State fixture: a 10,000-row × 8-column integer DataFrame and a 10,000-integer list.
Restore runs in a fresh kernel, including pandas imports; kernel startup is excluded.
Kernel RSS covers the isolated Python process; loaded RSS follows the pandas workload.
Costs estimate full sandbox lifetimes at configured rates, including setup and build.
Budget target: $1; not a billing cap. Checks are informational.

Metric Main successful/attempted PR successful/attempted Main spread PR spread
Cold startup 10/10 10/10 IQR 113.2 ms IQR 68.8 ms
Warm startup 10/10 10/10 IQR 54.8 ms IQR 34.7 ms
Installation 3/3 3/3 range 0.41 s range 0.44 s
Compressed release artifacts 1/1 1/1
Installed footprint 1/1 1/1
Idle memory, summed RSS 10/10 10/10 IQR 15.86 MB IQR 30.67 MB
Python kernel startup 10/10 10/10 IQR 10.8 ms IQR 8.9 ms
Python cell round trip 10/10 10/10 IQR 0.105 ms IQR 0.062 ms
Empty bash command 10/10 10/10 IQR 1.0 ms IQR 0.9 ms
Bash git status 10/10 10/10 IQR 1.4 ms IQR 1.1 ms
Bash 32 KiB output 10/10 10/10 IQR 1.1 ms IQR 0.2 ms
35 cells / 9 shell calls 10/10 10/10 IQR 20.2 ms IQR 12.2 ms
Python interrupt to done 10/10 10/10 IQR 0.195 ms IQR 0.188 ms
Python state snapshot 10/10 10/10 IQR 6.2 ms IQR 1.0 ms
Python state restore 10/10 10/10 IQR 37.4 ms IQR 18.8 ms
Python idle RSS 10/10 10/10 IQR 3.46 MB IQR 3.83 MB
Python RSS after pandas workload 10/10 10/10 IQR 3.84 MB IQR 2.45 MB

kevinjosethomas added a commit that referenced this pull request Sep 9, 2026
@kevinjosethomas
kevinjosethomas changed the base branch from main to feat/eng-6046-native-migration September 9, 2026 23:55
@kevinjosethomas
kevinjosethomas changed the base branch from feat/eng-6046-native-migration to main September 10, 2026 01:32
Comment thread install.sh Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/coding-agent/src/utils/version-check.ts Outdated
@kevinjosethomas
kevinjosethomas added this pull request to stack #2209 September 10, 2026 21:25
kevinjosethomas added a commit that referenced this pull request Sep 10, 2026
kevinjosethomas added a commit that referenced this pull request Sep 10, 2026
Comment thread install.sh

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/coding-agent/src/cli/native-update.ts
@kevinjosethomas
kevinjosethomas force-pushed the feat/eng-6047-native-updates branch from 289b2ce to 4164228 Compare September 12, 2026 08:18
Comment thread install.sh Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4164228. Configure here.

Comment thread install.sh
Comment thread packages/coding-agent/src/config.ts Outdated
Comment thread packages/coding-agent/src/utils/version-check.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants